package com.godyao.mall.user.api.feign;

import com.godyao.mall.core.model.ResultMsg;
import com.godyao.mall.user.api.feign.fallback.UserFeignFallback;
import com.godyao.mall.user.common.model.SysRole;
import com.godyao.mall.user.common.model.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author godyao
 * @date 2022/4/2
 */
@FeignClient(value = "mall-user-boot", contextId = "user-boot", fallback = UserFeignFallback.class)
public interface UserFeign {
    @GetMapping("/mall-user-boot/user/getByUsername")
    ResultMsg<SysUser> getByUsername(@RequestParam(value = "username") String username);

    @GetMapping("/mall-user-boot/user/getRolesByUserId")
    ResultMsg<List<SysRole>> getRolesByUserId(@RequestParam(value = "userId") Long userId);

    @GetMapping("/mall-user-boot/user/getByUserId")
    ResultMsg<SysUser> getByUserId(@RequestParam(value = "userId") String userId);

    @GetMapping("/mall-user-boot/user/listByUserId")
    ResultMsg<List<SysUser>> listByUserId(@RequestBody List<String> userIds);
}
